/*
 * @Description: 全宗reducer
 * @Author: Rfan
 * @Date: 2022-01-08 16:30:05
 * @LastEditTime: 2022-03-14 16:05:24
 */

import {
  ADD_ARCNO_RULE,
  EDIT_ARCNO_RULE,
  SET_ARCNO_RULE,
  SET_SELECT_AT,
  SET_SELECT_FOND
} from '../constants';

export const ArchivalCodeReducer = (state, action) => {
  switch (action.type) {
    /**
     * @description: 表格加载loading
     */
    case SET_SELECT_FOND:
      return {
        ...state,
        selectFond: action.data
      };

    /**
     * @description: 设置选中的档案类型
     */
    case SET_SELECT_AT:
      return {
        ...state,
        selectAT: action.data
      };

    /**
     * @description: 设置选中的档案类型
     */
    case SET_ARCNO_RULE:
      return {
        ...state,
        initRule: action.data || {}
      };

    /**
     * @description: 设置选中的档案类型
     */
    case ADD_ARCNO_RULE:
      return {
        ...state,
        initRule: action.data || {}
      };

    /**
     * @description: 设置选中的档案类型
     */
    case EDIT_ARCNO_RULE:
      return {
        ...state,
        initRule: action.data || {}
      };

    default:
      console.log('untouched', action);
      return state;
  }
};
